package com.woniu.product.controller;

import com.woniu.product.entity.Product;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

    @Value("${server.port}")
    String port;

    @RequestMapping("/product/{id}")
    public Product findProductById(@PathVariable int id){
        Product product = new Product();

        product.setId(id);
        product.setName("产品测试");
        product.setPrice(999.99);
        product.setPort(port);

        //根据id查询商品信息
        return product;
    }
}
